package com.yxuan.springboot.controller;

import com.yxuan.springboot.model.GaokaoDocument;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import com.yxuan.springboot.model.OfficialDocument;
import org.springframework.web.bind.annotation.ResponseBody;

import java.io.IOException;

/**
 * 
 * @author zchao
 *   OfficialDocument控制器
 * @date 2023-11-25 14:17:42
 */
@Controller
@Api(tags = "官方文件")
@RequestMapping(value = "/officialdocument", method = {RequestMethod.POST,RequestMethod.GET})
public class OfficialDocumentController extends BaseController<OfficialDocument>{
    @ApiOperation(value = "修改数据", notes = "修改数据",httpMethod = "PUT")
    @RequestMapping("/updT")
    @ResponseBody
    public String updT(@RequestBody OfficialDocument entity) throws Exception {
        try {
            return baseService.upd(entity);
        } catch (Exception e) {
            e.printStackTrace();
            return ERROR;
        }
    }

    @ApiOperation(value = "添加数据", notes = "添加数据",httpMethod = "POST")
    @RequestMapping("/saveT")
    @ResponseBody
    public String saveT(@RequestBody OfficialDocument entity) throws IOException {
        try {
            return baseService.save(entity);
        } catch (Exception e) {
            e.printStackTrace();
            return ERROR;
        }
    }

}
